import item from '../base/item'
import { Arms } from '../../config/play_def'
cc.Class({
    extends: item,

    properties: {
        //    icon:cc.Sprite,//放置提示图标  类似 空    已解锁
        lock: cc.Node
    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    start() {

    },

    // update (dt) {},
    initItem(info, index) {
        if (info) {
            this.info_lab.string = `Lv${info.equips[index]}`
        }
        if (info.equips[index] == 0) {
            this.info_lab.node.active = false
            this.lock.active = true
        } else {
            this.info_lab.node.active = true
            this.lock.active = false
        }
        let roleName = null
        let wapenName = null
        switch (info.id) {
            case 1001:
                roleName = 'blue'
                break
            case 1002:
                roleName = 'red'
                break
            case 1003:
                roleName = 'yellow'
                break
            case 1004:
                roleName = 'pink'
                break
            case 1005:
                roleName = 'black'
                break
        }
        switch (index) {
            case Arms.MachineGun:
                wapenName = '_gun'
                break
            case Arms.Pistol:
                wapenName = '_pistol'
                break
            case Arms.Bow:
                wapenName = '_arch'
                break
            case Arms.Sword:
                wapenName = '_sword'
                break
        }
        let name = `${roleName}${wapenName}`
        this.head_sp.spriteFrame = he.load.get('equip', cc.SpriteAtlas).getSpriteFrame(name)

    },
});
